package com.shfl.stock;

import com.shfl.rect.RectD;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;

import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 一些配置参数
 */
public class Stock {

    public static Stage INDEX_STAGE = new Stage();

    public static final Object obj = new Object();

    public static RectD rd = null;

    /**
     * 初始化线程池
     * 使用线程池要注意关闭
     */
    public static ExecutorService executor = Executors.newFixedThreadPool(5);


    //配置文件
    public static String proUrl = "/dev_application.properties";


//    public static ExecutorService executor = Executors.newFixedThreadPool(5, new ThreadFactory() {
//
//        AtomicInteger threadNumber = new AtomicInteger(0);
//        @Override
//        public Thread newThread(Runnable r) {
//
//            Thread thread = new Thread();
//            thread.setDaemon(true);
//            int number = threadNumber.incrementAndGet();
//            System.out.println("number:"+number);
//            thread.setName("thread-pool-" + number);
//            return thread;
//        }
//    });



    //宽度
    public static Integer width = 610;

    //高度
    public static Integer height = 610;

    /**
     * 场景一的布局
     *
     * @return
     */
    public static Parent parent1() {
        Parent root = null;
        try {
            root = FXMLLoader.load(Stock.class.getResource("/fxml/index.fxml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return root;
    }

    ;

    /**
     * 场景二的布局
     *
     * @return
     */
    public static Parent parent2() {
        Parent root = null;
        try {
            root = FXMLLoader.load(Stock.class.getResource("/fxml/convertImage.fxml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return root;
    }

    ;
}
